import request from '@/utils/request'

/* 获取区域的接口 */
export const fetchAreaListAPI = (pageParams) => {
  return request({
    url: '/parking/area/list',
    method: 'GET',
    params: pageParams
  })
}

/* 删除区域的接口 */
export const deleteAreaAPI = (id) => {
  return request({
    url: `/parking/area/${id}`,
    method: 'DELETE'
  })
}

/* 获取关联区域接口 */
export const fetchDropListAPI = () => {
  return request({
    url: '/parking/rule/dropList',
    method: 'GET'
  })
}

/* 添加或者编辑区域的接口 */
export const addOrUpdateAreaAPI = (data) => {
  if (data.id) {
    return request({
      url: `/parking/area`,
      method: 'PUT',
      data
    })
  } else {
    return request({
      url: `/parking/area`,
      method: 'POST',
      data
    })
  }
}
